<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="__PUBLIC__/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>添加用户</title>
</head>
<body>
<table class="table">
	<tr>
		<td width="200" class="va-t"><ul id="treeDemo" class="ztree"></ul></td>
		<td class="va-t"><IFRAME ID="testIframe" Name="testIframe" FRAMEBORDER=0 SCROLLING=AUTO width=100%  height=400px SRC="/index.php?m=Admin&c=CrmUser&a=oaUser"></IFRAME></td>
	</tr>
</table>
<script type="text/javascript" src="__PUBLIC__/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/layer/2.1/layer.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/js/H-ui.js"></script> 
<script type="text/javascript" src="__PUBLIC__/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="__PUBLIC__/js/getUrl.js"></script> 
<script type="text/javascript">
// 全局
var info={
	crmId:$.getUrlVar('crmId'),
}
$(function(){
	$("#testIframe").attr("SRC",'/index.php?m=Admin&c=CrmUser&a=oaUser&crmId='+info.crmId);
})

</script>
<script type="text/javascript">
var setting = {
	view: {
		dblClickExpand: false,
		showLine: false,
		selectedMulti: false
	},
	data: {
		simpleData: {
			enable:true,
			idKey: "DEPT_ID",
			pIdKey: "DEPT_PARENT",
			rootPId: ""
		},
		key:{
			name:"DEPT_NAME"
		}
	},
	callback: {
		beforeClick: function(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("tree");
			// if (treeNode.isParent) {
			// 	zTree.expandNode(treeNode);
			// 	return false;
			// } else {
			// 	console.log(treeNode);
			// 	var str='/index.php?m=Admin&c=CrmUser&a=oaUser&crmId='+info.crmId+'&id='+treeNode.DEPT_ID;
			// 	demoIframe.attr("src",str);
			// 	return true;
			// }
			var str='/index.php?m=Admin&c=CrmUser&a=oaUser&crmId='+info.crmId+'&id='+treeNode.DEPT_ID;
				demoIframe.attr("src",str);
				return true;
		}
	}
};

var zNodes =[
	{ id:1, pId:0, name:"一级分类", open:true},
	{ id:11, pId:1, name:"二级分类"},
	{ id:111, pId:11, name:"三级分类"},
	{ id:112, pId:11, name:"三级分类"},
	{ id:113, pId:11, name:"三级分类"},
	{ id:114, pId:11, name:"三级分类"},
	{ id:115, pId:11, name:"三级分类"},
	{ id:12, pId:1, name:"二级分类 1-2"},
	{ id:121, pId:12, name:"三级分类 1-2-1"},
	{ id:122, pId:12, name:"三级分类 1-2-2"},
];
		
var code;
		
function showCode(str) {
	if (!code) code = $("#code");
	code.empty();
	code.append("<li>"+str+"</li>");
}

function getdept(){
	$.get("/index.php?m=Service&c=Dept&a=getdept",function(data){
		// console.log(data);
		zNodes=[];
		zNodes=data;
		console.log(zNodes);
		var t = $("#treeDemo");
		t = $.fn.zTree.init(t, setting, zNodes);
		demoIframe = $("#testIframe");
		// demoIframe.bind("load", loadReady);
		// var zTree = $.fn.zTree.getZTreeObj("tree");
		// zTree.selectNode(zTree.getNodeByParam("id",'11'));
		});
}
		
$(document).ready(function(){
	getdept();

	
});
</script>
</body>
</html>